<?php
include_once("../modules/checkA.php");
include_once("../../config.php"); 


$page_url = 'detail-list-themes.php'; //页数公用    自定义URL
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];

/* 权限判断 */
admin_priv('weixin');

include_once("select_datas_themes.php");


$mp_list = select_lines_all_items($table_Prefix.'wechat_official','nid desc',"","");

$new_mp_list = array();
foreach($mp_list as $key=>$val){
	$new_mp_list[$val['nid']]['nid'] = $val['nid'];
	$new_mp_list[$val['nid']]['name'] = $val['name'];
}

unset($mp_list);
?>
 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
   <?php include ROOT_PATH_.'/controller/common/module/head.php'; ?>
    <?php include 'modules/head.php'; ?>
</head>

<body>

<div id="topbar">   <?php include ROOT_PATH_.'/controller/common/module/topbar.php'; ?></div>

<div id="container" class="<? echo $system_part ?>">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controller/common/module/sidebar.php'; ?>
        </div>

		<div id="content">
			<h1> 模板推送列表 </h1>

			<div class="select-box layui-form">
				<form action="detail-list.php" >

                    <div class="layui-form-item">
                        <label class="layui-form-label">关键词</label>
                        <div class="layui-input-block">
                            <input type="text" name="select_keywords" placeholder="可搜索模板id" autocomplete="off" class="layui-input" value="<? echo $_REQUEST['select_keywords']?>" >
                        </div>
                    </div>
                  	
                    <div class="layui-form-item">
                        <label class="layui-form-label">公众号选择</label>
                        <div class="layui-input-block">
                          <select name="mp_id" lay-verify="required">
                            <option value=""></option>
                            <?php 
							foreach($new_mp_list as $val){
								$select = '';
								if($_REQUEST['mp_id'] == $val['nid']){
									$select = 'selected="selected"';
								}
								echo '<option value="'.$val['nid'].'" '.$select.' >'.$val['name'].'</option>';
							}
							?>
                          </select>
                        </div>
                      </div>
                      
                    <button class="layui-btn" style="height:38px;">查找</button>

				</form>
			
    			<br class="clearfloat"/>
                
                
			</div>


			<div class="list-box">
            	<a class="layui-btn" href="detail_info_themes.php?act=add&nav-itemed=wechat" style="height:38px; line-height:38px; color:#fff;">新增模板</a><br />
				<div class="list-boxes layui-form">
					<table class="layui-table">
                      <colgroup>
                        
                        <col width="400">
                        <col > 
                        <col > 
                    
                    
                      </colgroup>
                      <thead>
                        <tr>      
                          
                          <th>模板编号</th>
                          <th>模板名字</th>
                          <th>模板链接</th>
                          <th>所属公众号</th>                
                          <th>操作</th>
                        </tr> 
                      </thead>
                      <tbody>
       					<?php
						 
						foreach($detail as $value){
							
						?>
                        <tr>
                        	
                        	<td><?php echo $value['themes_sn'];?></td>
                        	<td><?php echo $value['themes_name'];?></td>
                        	<td><?php echo $value['themes_url'];?></td>
                        	<td><?php echo $new_mp_list[$value['mp_id']]['name'];?></td>
                        
                        	<td><a href="detail_info_themes.php?act=edit&id=<?php echo $value['t_id'];?>&nav-itemed=wechat">编辑</a> | <a href="javascript:detele_info(<?php echo $value['t_id'];?>)">删除</a></td>
                        </tr>
                        <?php 
						}
						?>
                      </tbody>
                    </table>
				</div>

                <div class="list-box-function" <? if ($detailnum == 0) {  echo "style" . "='display:none'"; } ?>>
    				<?php include 'page_numbers.php'; ?>
				</div>
            <!--list-box end-->
            </div>

			<!--content端點01-->
		</div>
        <!--maincontent端點01-->
        <br class="clearfloat"/>
	</div>
<!--container端點01-->
</div>


<script type="text/javascript">

function detele_info(id){
  var r=confirm("确定要删除当前数据吗？")
  if (r==true){
	window.location.href='detail_info_themes.php?act=delete&id='+id+'&nav-itemed=wechat';
  }
}

</script>



<?php include ROOT_PATH_ . "/controller/common/module/footer.php"; ?> </body>
</html>
